package com.qf.utils;

import cn.hutool.core.date.DateUtil;
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;

import java.io.UnsupportedEncodingException;
import java.util.Date;

public class TokenUtils {
    public static String createToken(String userId, String userPass) throws UnsupportedEncodingException {
        return JWT.create().withAudience(userId, userPass).withExpiresAt(DateUtil.offsetMinute(new Date(), 30)).sign(Algorithm.HMAC256(userPass));
    }
}
